LGF_StartValueReadWrite (FB / 1.0.0)

Overview

Author: Simatic Systems Support

Short description

Read or write start value(s) from variables or complete data blocks

Block Interface

LGF_StartValueReadWrite (FB)
Bool  read readDone  Bool
    
Bool  write writeDone  Bool
    
Variant  dataSource busy  Bool
    
Variant  dataDestination error  Bool
    
   lastRead  DTL
    
   lastWrite  DTL
    
   status  Word
    
   diagnostics  LGF_typeDiagnostics
    
   

Input parameter

IdentifierData type Default value Description
readBool FALSE Rising edge: Read start value of data block / Variable of data block
writeBool FALSE Rising edge: Write actual value(s) to start value of data block / Variable of data block
dataSourceVariant --- Data (block / variable) source, if a separate source is needed.
May also be `NULL` - then the target is also used as the source
dataDestinationVariant --- Data (block / variable) destination

Output parameter

IdentifierData type Description
readDoneBool TRUE: Read has been completed successfully
writeDoneBool TRUE: Write has been completed successfully
busyBool TRUE: FB is not finished and new output values can be expected
errorBool TRUE: An error occurred during the execution of the FB
lastReadDTL Timestamp of last read access
lastWriteDTL Timestamp of last write access
statusWord 16#0000 - 16#7FFF: Status of the FB, 16#8000 - 16#FFFF: Error identification
diagnosticsLGF_typeDiagnostics Diagnostic information

Status & Error codes

Code / ValueIdentifier / Description
16#0001STATUS_READ_DONE
Read execution finished without errors
16#0002STATUS_WRITE_DONE
Write execution finished without errors
16#7000STATUS_NO_CALL
No job being currently processed
16#7001STATUS_READ
Read value(s) in progress
16#7002STATUS_WRITE
Write value(s) in progress
16#8400ERR_MULTIPLE_COMMANDS
Error: Multiple commands add the same time not allowed.
16#8600ERR_UNDEFINED_STATE
Error: Undefined state in state machine
16#8601ERR_READ
Error: Read value(s) `READ_DBL` - see `diagnostics.subfunctionStatus`
16#8602ERR_WRITE
Error: Write value(s) `WRITE_DBL` - see `diagnostics.subfunctionStatus`
16#8611ERR_READ_TIME
Error: Read timestamp `RD_LOC_T` while read values - see `diagnostics.subfunctionStatus`
16#8612ERR_WRITE_TIME
Error: Write timestamp `WR_LOC_T` while write values - see `diagnostics.subfunctionStatus`

User defined datatype(s)

LGF_typeDiagnostics (UDT / V1.0.1)

Diagnostic structure to store and transfer diagnostic information from blocks through the interface.

Identifier Data type Default value Description
status Word 16#0000 Status of the Block or error identification when error occurred
subfunctionStatus Word 16#0000 Status or return value of called FB's, FC's and system blocks
stateNumber DInt 0 State in the state machine of the block where the error occurred

Functional description

The function reads or writes the start value of a single variable, a structured variable or an entire data area or data block from the source to the destination.

The parameter dataDestination must always be present, the parameter dataSource is optional.
If dataSource is not used, the function...


NOTE
If the start values are written, the data block then appears in engineering as an "inconsistent" data block after the values have been written by the user program.

NOTE
In order to use complete data blocks, they must be derived from a PLC data type.

Note
A change to the start values can no longer be reversed without further modifications.

The possibilities are, for example:


Caution
The changes are written to the SMC (Simatic Memory Card).
The SMC is a flash memory with limited write cycles, so you should not write cyclically to the SMC!

Change log

Version & DateChange description
1.0.0Simatic Systems Support
2025-05-05First released version